using System;
using System.Collections.Generic;
using System.Text;

namespace DacTaHinhThuc
{
    /// <summary>
    /// class tham so
    /// </summary>
    public class Parameter
    {
        #region fields
        private string m_strName;   //luu ten cua tham so
        private string m_strType;   //luu loai tham so
        private string m_strSystemType; //luu loai tham so cua he thong
        private string m_strSet;    //tham so thuoc tap hop nao? N, R, Z, Q ...
        private bool m_bIsArr = false;       //kiem tra xem 1 bien co phai la bien kieu mang hay khong
                                    //true: neu phai
<<<<<<< .mine
        private bool m_bIsSet = false;      //la bien kieu tap hop
=======
        private bool m_bIsSet;      //la bien kieu tap hop
>>>>>>> .r17
        #endregion

        #region properties
        public bool IsSet
        {
            get { return this.m_bIsSet; }
            set { this.m_bIsSet = value; }
        }
        public string Name
        {
            get { return this.m_strName; }
            set { this.m_strName = value; }
        }
        public string Type
        {
            get { return this.m_strType; }
            set { this.m_strType = value; }
        }
        public bool IsArr
        {
            get { return this.m_bIsArr; }
            set { this.m_bIsArr = value; }
        }
        public string Set
        {
            get { return this.m_strSet; }
            set { this.m_strSet = value; }
        }
        public string SystemType
        {
            get { return this.m_strSystemType; }
            set { this.m_strSystemType = value; }
        }
        #endregion

        #region methods
        public Parameter()
        {
        }
        public Parameter(string name, string set)
        {
            this.m_strName = name;
            this.m_strSet = set;
            if (set[0] == '*')
            {
                //day la bien kieu mang
                this.m_bIsArr = true;
                //mapping bat dau tu vi tri thu 1
                this.m_strType = Mapping.MappingSetToType(set.Substring(1));
                this.m_strSystemType = Mapping.MappingSetToSystemType(set.Substring(1));
            }
            else
            {
                if (set.Contains("-set"))
                {
                    //day la bien kieu tap hop
                    this.m_bIsSet = true;
                    //mapping bo di 4 ky tu cuoi
                    this.m_strType = Mapping.MappingSetToType(set.Substring(0, set.Length - "-set".Length));
                    this.m_strSystemType = Mapping.MappingSetToSystemType(set.Substring(0, set.Length - "-set".Length));
                }
                else
                {
                    this.m_bIsArr = false;
                    this.m_strType = Mapping.MappingSetToType(set);
                    this.m_strSystemType = Mapping.MappingSetToSystemType(set);
                }
                this.m_strSystemType = Mapping.MappingSetToSystemType(set);            
            }            
        }
        #endregion
    }
}
